package views;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import model.DbHelper;


public class AddCarPanel extends JPanel {
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private JComboBox comboBox;
	private JComboBox comboBox_1;
	private JComboBox comboBox_2;
	private JComboBox comboBox_3;
	private JComboBox comboBox_4;

	/**
	 * Create the panel.
	 */
	public AddCarPanel() {
		setLayout(new BorderLayout(0, 0));
		
		JPanel panel = new JPanel();
		add(panel, BorderLayout.CENTER);
		DbHelper myHelper = new DbHelper();
		
		Box verticalBox = Box.createVerticalBox();
		panel.add(verticalBox);
		
		JLabel lblVehicleSno = new JLabel("Vehicle SNO:");
		verticalBox.add(lblVehicleSno);
		
		textField = new JTextField();
		verticalBox.add(textField);
		textField.setColumns(10);
		
		JLabel label = new JLabel("Car Model:");
		verticalBox.add(label);
		
		textField_1 = new JTextField();
		verticalBox.add(textField_1);
		textField_1.setColumns(10);
		
		JLabel lblCarType = new JLabel("Car Type:");
		verticalBox.add(lblCarType);
		
		comboBox = new JComboBox(myHelper.getCarTypes());
		verticalBox.add(comboBox);
		
		JLabel lblLocation = new JLabel("Location");
		verticalBox.add(lblLocation);
		
		comboBox_1 = new JComboBox(myHelper.getLocations());
		verticalBox.add(comboBox_1);
		
		JLabel lblColor = new JLabel("Color:");
		verticalBox.add(lblColor);
		
		textField_2 = new JTextField();
		verticalBox.add(textField_2);
		textField_2.setColumns(10);
		
		JLabel lblNewLabel = new JLabel("Hourly Rate:");
		verticalBox.add(lblNewLabel);
		
		textField_3 = new JTextField();
		verticalBox.add(textField_3);
		textField_3.setColumns(10);
		
		JLabel lblDailyRate = new JLabel("Daily Rate:");
		verticalBox.add(lblDailyRate);
		
		textField_4 = new JTextField();
		verticalBox.add(textField_4);
		textField_4.setColumns(10);
		
		JLabel lblSeatCap = new JLabel("Seating Capacity:");
		verticalBox.add(lblSeatCap);
		
		textField_5 = new JTextField();
		verticalBox.add(textField_5);
		textField_5.setColumns(10);
		
		JLabel lblTranType = new JLabel("Transmission Type:");
		verticalBox.add(lblTranType);
		
		comboBox_2 = new JComboBox(myHelper.getTransmissionType());
		verticalBox.add(comboBox_2);
		
		JLabel lblBluetooth = new JLabel("Bluetooth Connectivity:");
		verticalBox.add(lblBluetooth);
		
		comboBox_3 = new JComboBox(myHelper.getBluetooth());
		verticalBox.add(comboBox_3);
		
		JLabel lblAuxCable = new JLabel("Auxiliary Cable:");
		verticalBox.add(lblAuxCable);
		
		comboBox_4 = new JComboBox(myHelper.getAuxCable());
		verticalBox.add(comboBox_4);
		
		JButton addCarButton = new JButton("Add Car");
		verticalBox.add(addCarButton);
		addCarButton.addActionListener(new MyActionListener());
		
		JLabel lblAddCars = new JLabel("Add Cars:");
		add(lblAddCars, BorderLayout.NORTH);

	}
	
	private class MyActionListener implements ActionListener {

		@Override
		public void actionPerformed(ActionEvent arg0) {
			String vin = textField.getText();
			String model = textField_1.getText();
			String type = String.valueOf(comboBox.getSelectedItem());
			String location = String.valueOf(comboBox_1.getSelectedItem());
			String color = textField_2.getText();
			String hourly = textField_3.getText();
			String daily = textField_3.getText();
			String seating;
			String transmission;
			String bluetooth;
			String auxCable;
			
		}
		
	}

}
